import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import bus from './lib/bus';
import CountTo from '_c/count-to';
import iView from "iview";
import 'iview/dist/styles/iview.css';
import './assets/font/iconfont';
import './assets/font/iconfont.css';
import iconFont from './components/icon-font';
import iconSvg from './components/icon-svg';

if (process.env.NODE_ENV !== 'production') require('./mock');

Vue.config.productionTip = false;
Vue.prototype.$bus = bus;
Vue.component('icon-font', iconFont);
Vue.component('icon-svg', iconSvg);
Vue.use(iView);

const handleClick = event => {
	//阻止冒泡
	event.stopPropagation();
};

const list = [{name: 'Tom'}, {name: 'Jerry'}];
const getLiEleArr = h => {
	return list.map((item,index) => h('li', {
		on: {
			'click': handleClick
		},
		key: `list_item_${index}`
	}, item.name));
};

new Vue({
	router,
	store,
	render: h => h(App)

	/*render: h => {
		return h('div', {
			attrs: {
				id: 'box'
			},
			style: {
				color: 'pink'
			}
		}, 'render function');*/

	/*return h(CountTo, {
		/!**
		 * 类名
		 *!/
		'class': [],
		style: [],
		attrs: {},
		/!**
		 * 属性
		 *!/
		props: {endVal: 100},
		/!**
		 * 在dom上的属性
		 *!/
		domProps: {},
		/!**
		 * 事件绑定
		 *!/
		on: {
			'on-animation-end': (value) => {
				console.log('animation-end->', value);
			}
		},
		/!**
		 * 自定义事件
		 *!/
		nativeOn: {
			'click': () => {
				console.log('click');
			}
		},
		/!**
		 * 指令
		 *!/
		directives: [],
		scopedSlots: {},
		/!**
		 * 插槽
		 *!/
		slot: '',
		key: '',
		ref: ''
	})
}*/

	/*render: h => h('div', [
		h('ul', {
				on: {
					'click': handleClick
				}
			}, getLiEleArr(h)
			// [
			// 	h('li', {
			// 		on: {'click': handleClick}
			// 	})
			// ]
		),
	])*/
}).$mount('#app');
